import React, { Component } from 'react'
import Top from './Top'
import Content from './Content'
import Footer from './Footer'
import CTX from './store/Ctx'
import ShouK from './ShouK'

export default class Vote3 extends Component {

    state = {
        title: '今天的饭菜怎么样',
        sup: 100,
        opp: 1
    }

    changeProson = (type, n) => {
        if (type == true) {
            this.setState({ sup: this.state.sup + n })
        } else {
            this.setState({ opp: this.state.opp + n })
        }
    }

    render() {
        return (<CTX.Provider value={{
            ...this.state,
            changeProson: this.changeProson
        }}>
            <div>
                <Top title1={this.state.title}></Top>
                <Content {...this.state}></Content>
                <Footer changeProson1={this.changeProson} ></Footer>
                <ShouK></ShouK>
            </div>
        </CTX.Provider>

        )
    }
}

